﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tomato.Libraries.Patterns;

namespace Tomato.Libraries.Logging
{
    [EventSource( Name = "Tomato" )]
    public class TomatoEventSource : EventSource
    {
        public class Keywords
        {
            public const EventKeywords Page = ( EventKeywords ) 1;
            public const EventKeywords DataBase = ( EventKeywords ) 2;
            public const EventKeywords Diagnostic = ( EventKeywords ) 4;
            public const EventKeywords Perf = ( EventKeywords ) 8;
        }

        public class Tasks
        {
            public const EventTask Page = ( EventTask ) 1;
            public const EventTask DBQuery = ( EventTask ) 2;
        }

        public static void WriteInfomation( string message )
        {
            Singleton<TomatoEventSource>.Instance.Information( message );
        }

        [ Event( 1,
                 Keywords = Keywords.Diagnostic,
                 Level    = EventLevel.Informational,
                 Message  = "Information : {0}",
                 Opcode   = EventOpcode.Info,
                 Task     = EventTask.None,
                 Version  = 1 ) ]
        private void Information( string message )
        {
            WriteEvent( 1, message );
        }

    }

}